//
//  Tab_SetBadgeHandler.swift
//  mall-ios
//
//  Created by Meak Tsui on 2018/12/5.
//  Copyright © 2018 Meak Tsui. All rights reserved.
//

import Foundation
import MTHybrid

class Tab_SetBadgeHandler: MTEventHandler {
    var ns: Ns {
        return .Tab
    }
    
    var action: Api {
        return .SetBadge
    }
    
    /// 设置底部tabbarbadge数量，空字符串显示一个小红点，nil时不显示
    ///
    /// - Parameter params: 请求参数
    func handler(_ msg: MTHybridMsg) {
        let text = msg.params["text"] as? String
        msg.vc.navigationController?.tabBarItem.badgeValue = text
        msg.callbackClosure?("null")
    }
    
}
